from abc import ABC, abstractmethod
from may.config import MayConfig
from may.conn_pool import SSHConnectionPool

servers_modules = ["yaml_file"]


class AbstractServers(ABC):
    """
    this is abstarct server class
    to define necessary method for ssh connection pool
    """

    def __init__(self, config: MayConfig) -> None:
        self.config = config

    def _init_conn_pool(self):
        SSHConnectionPool(self.list_servers(), self.config["ssh_conn_pool"])

    @abstractmethod
    def list_servers(self) -> list:
        """
        list all loaded server
        :return a list of Server
        """

    @abstractmethod
    def get_servers(self, **kwargs):
        """
        get server by attribute
        :return: a list of Server
        """

    @abstractmethod
    def reload(self):
        """reload server from source"""
